/*
 * @lc app=leetcode.cn id=171 lang=javascript
 *
 * [171] Excel 表列序号
 */

// @lc code=start
/**
 * @param {string} columnTitle
 * @return {number}
 */
var titleToNumber = function(columnTitle) {
    let footstone = 'A'.charCodeAt() - 1
    let res = 0
    for (let index = columnTitle.length - 1; index >= 0; index--) {
        const element = columnTitle[index];
        res += (element.charCodeAt() - footstone) * (26 ** (columnTitle.length - 1 - index))   
    }
    return res
};
// @lc code=end

